const path = require('path');
const resolve = filePath => path.resolve(__dirname, './', filePath);

module.exports = {
  outputDir: 'docs',
  publicPath: '/v3-components/',
  devServer: { port: 3366 },
  pages: {
    index: {
      entry: resolve('story/main.ts'),
      template: 'public/index.html',
      filename: 'index.html',
      title: 'v3-components',
    },
  },
  chainWebpack: config => {
    config.plugins.delete('prefetch-index').delete('preload-index');
    config.resolve.alias.set('story', resolve('story')).set('src', resolve('src'));
  },

  css: {
    // 全局引入scss文件
    loaderOptions: {
      sass: {
        prependData: `@import "src/style/global-import.scss";`,
      },
    },
  },
};
